package org.dendy.app.browser;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;

/**
 * Class ini berfungsi untuk Menambahkan Menu view pada menu bar
 * 
 * @author dendy
 * 
 */

public class MenuBarView extends MenuBarBrowser {

	MiniBrowser miniBrowser = null;

	ToolBrowser tBrowser = null;

	public MenuBarView(Shell shell) {
		this.shell = shell;
		bar = new Menu(shell, SWT.BAR);
	}

	@Override
	public Menu createMenuItem() {
		bar = shell.getMenuBar();
		Menu menu = new Menu(bar);

		// View->Toolbar
		item = new MenuItem(menu, SWT.PUSH);
		item.setText("Toolbar");
		item.setSelection(true);
		item.setText("&Toolbar");

		Listener listener = new Listener() {
			public void handleEvent(Event event) {
				if (item.getSelection()) {
					tBrowser.tBar.setVisible(true);
				} else {
					tBrowser.tBar.setVisible(false);
				}

			}
		};

		item.addListener(SWT.Selection, listener);
		return menu;
	}

}
